package com.wonyesoft.wuliu.acticity.order;

import httptools.HttpJsonTool;

import java.io.File;
import java.lang.reflect.Type;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;

import javabeen.CarTeamIdBeen;
import javabeen.DriverAddress;
import javabeen.OrderInfoBeen;
import javabeen.PushMessage;
import javabeen.ReceiveOrderMessageBeen;
import javabeen.passlocations;

import org.json.JSONException;
import org.json.JSONObject;

import View.InPutDialog;
import View.InPutDialog.getUserIntent;
import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Paint;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.Message;
import android.os.PowerManager;
import android.provider.MediaStore;
import android.provider.ContactsContract.Contacts.Data;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.inputmethod.EditorInfo;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.RadioGroup;
import android.widget.RelativeLayout;
import android.widget.SimpleAdapter;
import android.widget.TabHost;
import android.widget.TextView;
import android.widget.Toast;

import com.baidu.lbsapi.auth.LBSAuthManagerListener;
import com.baidu.mapapi.SDKInitializer;
import com.baidu.mapapi.model.LatLng;
import com.baidu.mapapi.search.geocode.GeoCoder;
import com.baidu.mapapi.search.route.DrivingRoutePlanOption;
import com.baidu.mapapi.search.route.PlanNode;
import com.baidu.mapapi.search.route.RoutePlanSearch;
import com.baidu.mapapi.utils.DistanceUtil;
import com.baidu.platform.comapi.map.m;
import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import com.google.gson.reflect.TypeToken;
import com.lidroid.xutils.BitmapUtils;
import com.lidroid.xutils.HttpUtils;
import com.lidroid.xutils.exception.HttpException;
import com.lidroid.xutils.http.RequestParams;
import com.lidroid.xutils.http.ResponseInfo;
import com.lidroid.xutils.http.callback.RequestCallBack;
import com.lidroid.xutils.http.client.HttpRequest;
import com.lidroid.xutils.util.PreferencesCookieStore;
import com.wonyesoft.wuliu.AppContent;
import com.wonyesoft.wuliu.R;
import com.wonyesoft.wuliu.acticity.ImageDetailsActivity;
import com.wonyesoft.wuliu.acticity.ZiFeiActivity;
import com.wonyesoft.wuliu.acticity.baidumap.ShowDriverInMap;
import com.wonyesoft.wuliu.acticity.bargain.BargainActionActivity;
import com.wonyesoft.wuliu.acticity.bargain.OrderSoundRecorder;
import com.wonyesoft.wuliu.acticity.base.BaseActivity;
import com.wonyesoft.wuliu.acticity.user.UserLinkMan_Activity;
import com.wonyesoft.wuliu.api.GagApi;

public class OrderDetails extends BaseActivity implements OnClickListener {

	private OrderSoundRecorder orderSoundRecorder;

	private TabHost mTabHost;
	private RadioGroup mRadioGroup;
	private RelativeLayout a11_common, a30_common;
	private TextView title, a12_common;
	private ImageView head_left, head_right;
	private ListView mylist;
	private SimpleAdapter adapter;
	private List<Map<String, Object>> list;
	private String aString;
	private LatLng pt1;
	private LatLng pt2;
	private GeoCoder mSearch = null;
	private double mi = 0.0;
	private int changeId = 0;
	private String carTypeId;
	private int driver_imgone_mark = 0;

	private Button a2_common;
	private Button a1_common;

	private LinearLayout dhqd;
	private TextView myorder_xiangxi_money;
	private TextView myorder_xiangxi_moneytext;

	private TextView myorder_xiangxi_origin;

	private TextView myorder_xiangxi_zhongdian1;
	private TextView myorder_xiangxi_zhongdian2;
	private TextView myorder_xiangxi_zhongdian3;

	private TextView myorder_xiangxi_payment;

	private TextView myorder_xiangxi_status;

	private TextView myorder_xiangxi_phone;

	private TextView myorder_xiangxi_shrphone;
	private ImageView driver_imgone;

	private TextView senderAdderss_2;
	private TextView myorder_xiangxi_goods, scts, jy;
	private TextView senderPhone;

	private TextView order_State_TextView;

	private ImageView bargain;
	private Gson gson = new Gson();
	private HttpUtils http = new HttpUtils();
	private RequestParams params;
	private AppContent app;
	private PreferencesCookieStore preferencesCookieStore;
	private String orderListId = "";
	private int NewOrderSate;
	Button accDriverprivate;
	private List<OrderInfoBeen> orderDataInfo;

	private RelativeLayout a9_common;
	private String nickBackPZ;
	private final String[] arraycargopaytype = new String[] { "线下支付", "在线支付" };

	private final String[] arraycargoisback = new String[] { "有回单", "没有回单" };

	private final String[] arraycargochargetype = new String[] { "到付", "预付" };

	private final String[] arraycargotype = new String[] { "易碎", "易燃", "易爆",
			"一般" };
	private final String[] arraycargoweight = new String[] { "1吨以下", "3吨以内",
			"5吨以内", "5吨以上" };
	private final String[] arraycargovolme = new String[] { "1立方米以内", "3立方米以内",
			"5立方米以内", "5立方米以上" };
	private final String[] arraycargocartype = new String[] { "小箱车(面包,金杯)",
			"0.5T车", "1T车", "2T车", "4T车", "5T车", "8T车" };
	private Bundle bundle2;
	private String[] noticeMsg = new String[] { "无", "无", "无" };
	private final String[] arraycargocarnotice = null;

	private int carTypeIds[] = { 1, 2, 3, 4, 5, 6, 7 };

	private int ownCarTypeId = 0;

	private String intPrice;

	public static final int INTENT_REQUEST_CODE_FLITER = 3;

	private Bitmap mUserPhoto;

	private String mTakePicturePath = null;

	private boolean mIsEngineInitSuccess = false;

	private RoutePlanSearch mPlanSearch = null;

	private int OrderState;

	private int position;

	EditText c;

	String cargoId;
	private TextView inPutOrigin;

	private TextView senderAdderss_1;

	private TextView sender_phone;
	private TextView senderPhone_1;

	private TextView senderPhone_2;

	private TextView deiver_input_money;

	private Button a2_common_new_2;

	private Button a1_common_new_2;

	List<DriverAddress> driverAddress;
	private String tag = OrderDetails.class.toString();
	private int play_sound_type = -1;

	boolean showpass = false;

	TextView add_driver_to_linkman;
	
	private TextView needvoucher;
	
	
	@SuppressLint("NewApi")
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		SDKInitializer.initialize(getApplicationContext());
		setContentView(R.layout.activity_myorder_conent_xiang_user);

		app = (AppContent) getApplication();
		app.addActivity(this);
		getIntentBundle(getIntent());
		// preferencesCookieStore = AppContent.getPreferencesCookieStore();

		TextView jy = (TextView) findViewById(R.id.j_y);
		jy.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				startActivity(new Intent(OrderDetails.this, ZiFeiActivity.class));
			}
		});
		app.isOrderActivity = true;
		app.OrderId = orderListId;
	}

	@SuppressLint("NewApi")
	private void getIntentBundle(Intent intent) {
		Bundle bundle = intent.getExtras();
		String Is_Play_sound;
		if (bundle != null) {
			Is_Play_sound = bundle.getString("Is_play_sound");


			c = new EditText(OrderDetails.this);
			if (mIsEngineInitSuccess) {

			}
			PushMessage pushMessage = (PushMessage) bundle
					.getSerializable("orderMessage");
			if (pushMessage != null) {
				if (pushMessage.getOrderId() != 0) {
					orderListId = pushMessage.getOrderId() + "";
					play_sound_type = 3;
				} else if (pushMessage.getListId() != 0) {
					orderListId = pushMessage.getListId() + "";
					play_sound_type = 2;
				} else if (pushMessage.getCompleteOrder() != 0) {
					orderListId = pushMessage.getCompleteOrder() + "";
					play_sound_type = 4;
				} else if (pushMessage.getGetRejectOrder() != 0) {
					orderListId = pushMessage.getGetRejectOrder() + "";
					play_sound_type = 5;
				} else if (pushMessage.getRemoveOrder() != 0) {
					orderListId = pushMessage.getRemoveOrder() + "";
					play_sound_type = 5;
				} else if (pushMessage.getNewinfoOrder() != 0) {
					Log.v("pushMessage.getNewinfoOrder() ",
							"" + pushMessage.getNewinfoOrder());
					orderListId = pushMessage.getNewinfoOrder() + "";
					play_sound_type = 3;
				}
			} else {
				orderListId = bundle.getInt("OrderId") + "";
			}

			/**
			 * 订单的id要加入空串不然推送为空
			 */

			// orderListId=bundle

			// orderListId = bundle.getString("listid") + "";
			Log.v("--------------------", "-----------------");
			Log.v("---------orderListId-----------", orderListId);
			// OrderState = bundle.getString("State");
			if (Is_Play_sound != null && Is_Play_sound.equals("play")) {
				Play_Sound();
			}
		}
		bundle2 = new Bundle();
		initIds();
		if (null != orderListId && !(orderListId.isEmpty())) {
			getPlanDetails();
			Log.v("orderListId", "" + orderListId);
		}
	}

	private void Play_Sound() {

		// soundPool.release();

		app.PlaySound(play_sound_type);

		PowerManager pm = (PowerManager) getSystemService(OrderDetails.POWER_SERVICE);

		PowerManager.WakeLock wl = pm.newWakeLock(
				PowerManager.ACQUIRE_CAUSES_WAKEUP
						| PowerManager.SCREEN_DIM_WAKE_LOCK, "bright");
		wl.acquire();
	}

	/**
	 * 货主选择重新派代订单，那么订单状态改为派单，且指定车主清空
	 */
	private void resetOrderStaeAPP() {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("orderId", orderListId);
		map.put("userId", app.userId);
		HttpJsonTool httpJsonTool = new HttpJsonTool(this);
		httpJsonTool.SetOnLister(new Handler() {
			@Override
			public void handleMessage(Message msg) {
				// TODO Auto-generated method stub
				super.handleMessage(msg);
				if (msg.what == 1) {
					Toast.makeText(OrderDetails.this, (String) msg.obj,
							Toast.LENGTH_LONG).show();
					app.OrderActivity_data_has_change = true;
					getPlanDetails();
				}
			}
		});

		httpJsonTool.StartWork(map, GagApi.RESET_ORDER_STATE, null, null);

	}

	/**
	 * 取消订单功能 orderId 订单ID Stirng userId 用户的ID String type 用户类型 String
	 * 
	 * 取消订单 货主真正取消订单，那么订单作废，将不会在派单
	 * 
	 */
	@SuppressWarnings("unused")
	private void rejectOrder() {

		Map<String, Object> map = new HashMap<String, Object>();
		map.put("orderId", orderListId);
		map.put("userId", app.userId);

		HttpJsonTool httpJsonTool = new HttpJsonTool(this);
		httpJsonTool.SetOnLister(new Handler() {
			@Override
			public void handleMessage(Message msg) {
				// TODO Auto-generated method stub
				super.handleMessage(msg);
				if (msg.what == 1) {
					Toast.makeText(OrderDetails.this, (String) msg.obj,
							Toast.LENGTH_LONG).show();
					OrderDetails.this.finish();
					app.OrderActivity_data_has_change = true;
				}
			}
		});
		httpJsonTool.StartWork(map, GagApi.REJECT_ORDER, null, null);

	}

	/**
	 * 放弃订单 货主放弃订单，状态该为放弃，且不退钱
	 */
	private void GiveUpOrder() {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("orderId", orderListId);
		map.put("userId", app.userId);

		HttpJsonTool httpJsonTool = new HttpJsonTool(this);
		httpJsonTool.SetOnLister(new Handler() {
			@Override
			public void handleMessage(Message msg) {
				// TODO Auto-generated method stub
				super.handleMessage(msg);
				if (msg.what == 1) {
					Toast.makeText(OrderDetails.this, (String) msg.obj,
							Toast.LENGTH_LONG).show();

					OrderDetails.this.finish();
					app.OrderActivity_data_has_change = true;
				}
			}
		});
		httpJsonTool.StartWork(map, GagApi.GIVE_UP_ORDER, null, null);

	}

	/**
	 * 转单功能
	 * 
	 * orderId 订单ID Stirng userId 用户的ID String type 用户类型 String
	 * 
	 * 货主不需要
	 * 
	 */
	// @SuppressWarnings("unused")
	// private void transportOrder() {
	//
	// Map<String, Object> map = new HashMap<String, Object>();
	// map.put("orderId",orderListId);
	// map.put("userId", app.userId);
	//
	// HttpJsonTool httpJsonTool = new HttpJsonTool(this);
	// httpJsonTool.SetOnLister(new Handler() {
	// @Override
	// public void handleMessage(Message msg) {
	// // TODO Auto-generated method stub
	// super.handleMessage(msg);
	// if (msg.what == 1) {
	// Toast.makeText(OrderDetails.this, "转单完成", Toast.LENGTH_LONG)
	// .show();
	// getPlanDetails();
	// }
	// }
	// });
	// httpJsonTool.StartWork(map,GagApi.TRANSPORT_ORDER, null,null);
	//
	// }

	/**
	 * 修改订单
	 */
	private void ModificationOrder() {
		Map<String, Object> map = new HashMap<String, Object>();
		// orderDataInfo
		Intent intent = new Intent(this, AddCargoOrderActivity.class);
		OrderInfoBeen orderInfoBeen = orderDataInfo.get(0);
		intent.putExtra("orderData", orderInfoBeen);
		startActivity(intent);
	}

	/**
	 * 确认订单 orderId 订单ID Stirng Price 最终定价 Stirng userId 用户的ID String type 用户类型
	 * String
	 */
	private void AcceptOrder() {
		showLoadingDialog("系统操作中...");
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("orderId", orderListId);
		// 这里到底填那个的价格
		// map.put("price", orderDataInfo.get(0).get + "");
		map.put("userId", app.userId);
		Log.v("接受", "接受");
		HttpJsonTool httpJsonTool = new HttpJsonTool(this);
		httpJsonTool.SetOnLister(new Handler() {
			@Override
			public void handleMessage(Message msg) {
				// TODO Auto-generated method stub
				super.handleMessage(msg);
				dismissLoadingDialog();
				if (msg.what == 1) {

					// Log.v("订单完成", "订单完成");
					// Toast.makeText(OrderDetails.this, "订单完成",
					// Toast.LENGTH_LONG)
					// .show();
					app.OrderActivity_data_has_change = true;
					app.OrderActivity_data_change_poition = "1";
					// sdfdsf
					getPlanDetails();
				} else {
					Toast.makeText(OrderDetails.this, (String) msg.obj,
							Toast.LENGTH_LONG).show();
				}
			}
		});
		httpJsonTool.StartWork(map, GagApi.ACCEPT_ORDER, null, null);
	}

	private void CompleteOrder() {
		Map<String, Object> data = new HashMap<String, Object>();
		data.put("userId", app.userId);
		data.put("orderId", orderListId);
		showLoadingDialog("系统操作中...");
		HttpJsonTool httpJsonTool = new HttpJsonTool(this);
		httpJsonTool.SetOnLister(new Handler() {
			@Override
			public void handleMessage(Message msg) {
				// TODO Auto-generated method stub
				super.handleMessage(msg);
				dismissLoadingDialog();
				app.OrderActivity_data_has_change = true;
				if (msg.what == 1) {
					Toast.makeText(OrderDetails.this, "订单完成，谢谢您使用Q货的",
							Toast.LENGTH_LONG).show();
					getPlanDetails();
				} else {

				}

			}
		});
		httpJsonTool.StartWork(data, GagApi.CompleteOrder, null, null);

	}

	private void userRejectReceipt() {
		Map<String, Object> data = new HashMap<String, Object>();
		showLoadingDialog("系统操作中...");
		data.put("orderId", orderListId);
		data.put("userId", app.userId);
		HttpJsonTool httpJsonTool = new HttpJsonTool(this);
		httpJsonTool.SetOnLister(new Handler() {
			@Override
			public void handleMessage(Message msg) {
				// TODO Auto-generated method stub
				super.handleMessage(msg);
				dismissLoadingDialog();
				if (msg.what == 1) {
					Toast.makeText(OrderDetails.this, "操作成功，请等待司机上传回单",
							Toast.LENGTH_LONG).show();
					getPlanDetails();
				} else {
					// Toast.makeText(OrderDetails.this, (String) msg.obj,
					// Toast.LENGTH_LONG).show();
					Toast.makeText(OrderDetails.this, "请检查您的网络状态...",
							Toast.LENGTH_LONG).show();
				}
			}
		});
		httpJsonTool.StartWork(data, GagApi.USER_REJECT_RECEIPT, null, null);
	}

	private TextView senderAdderss_3;

	private TextView senderPhone_3;

	private TextView zf;

	@SuppressLint("CutPasteId")
	private void initIds() {

		inPutOrigin = (TextView) findViewById(R.id.input_qi_dian);
		dhqd = (LinearLayout) findViewById(R.id.d_h_q_d);

		senderPhone = (TextView) findViewById(R.id.senderPhone);
		senderAdderss_1 = (TextView) findViewById(R.id.senderAdderss_1);

		senderAdderss_2 = (TextView) findViewById(R.id.senderAdderss_2);

		senderAdderss_3 = (TextView) findViewById(R.id.senderAdderss_3);
		senderPhone_1 = (TextView) findViewById(R.id.senderPhone_1);
		senderPhone_2 = (TextView) findViewById(R.id.senderPhone_2);
		senderPhone_3 = (TextView) findViewById(R.id.senderPhone_3);

		deiver_input_money = (TextView) findViewById(R.id.Driverprice);

		accDriverprivate = (Button) findViewById(R.id.ACCDRIVERPRIVE);

		needvoucher=(TextView) findViewById(R.id.needvoucher);
		



		order_State_TextView = (TextView) findViewById(R.id.Order_State);

		add_driver_to_linkman=(TextView) findViewById(R.id.add_driver_to_linkman);
		// sender_need_tiem = (TextView) findViewById(R.id.sender_need_tiem);
		// dhzd = (LinearLayout) findViewById(R.id.dhzd);
		myorder_xiangxi_origin = (TextView) findViewById(R.id.myorder_xiangxi_origin);
		dhqd.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				// getPosion(inPutOrigin.getText().toString().trim());
			}
		});
		// zf=(TextView)findViewById(R.id.jy);
		// myorder_xiangxi_zhongdian1=(TextView)
		// findViewById(R.id.myorder_xiangxi_zhongdian1);
		// myorder_xiangxi_zhongdian1.setOnClickListener(new OnClickListener() {
		//
		// @Override
		// public void onClick(View arg0) {
		// // TODO Auto-generated method stub
		//
		// }
		// });
		// myorder_xiangxi_zhongdian2=(TextView)
		// findViewById(R.id.myorder_xiangxi_zhongdian2);
		// myorder_xiangxi_zhongdian2.setOnClickListener(new OnClickListener() {
		//
		// @Override
		// public void onClick(View arg0) {
		// // TODO Auto-generated method stub
		// getPosion(myorder_xiangxi_origin.getText().toString().trim());
		// }
		// });
		// myorder_xiangxi_zhongdian3=(TextView)
		// findViewById(R.id.myorder_xiangxi_zhongdian3);
		// myorder_xiangxi_zhongdian3.setOnClickListener(new OnClickListener() {
		//
		// @Override
		// public void onClick(View arg0) {
		// // TODO Auto-generated method stub
		// getPosion(myorder_xiangxi_origin.getText().toString().trim());
		// }
		// });
		// dhqd.setOnClickListener(this);
		// dhzd.setOnClickListener(this);
		// jy = (TextView) findViewById(R.id.jy);
		// jy.setOnClickListener(this);
		// a30_common = (RelativeLayout) findViewById(R.id.a30_common);
		// a30_common.setOnClickListener(this);
		// myorder_xiangxi_shrphone = (TextView)
		// findViewById(R.id.myorder_xiangxi_shrphone);
		myorder_xiangxi_moneytext = (TextView) findViewById(R.id.myorder_xiangxi_money);
		// myorder_xiangxi_order = (TextView)
		// findViewById(R.id.myorder_xiangxi_order);

		myorder_xiangxi_money = (TextView) findViewById(R.id.myorder_xiangxi_money);

		// myorder_xiangxi_time = (TextView)
		// findViewById(R.id.myorder_xiangxi_time);
		//pay_type = (TextView) findViewById(R.id.pay_type);
		myorder_xiangxi_goods = (TextView) findViewById(R.id.myorder_xiangxi_goods);
		myorder_xiangxi_phone = (TextView) findViewById(R.id.myorder_xiangxi_phone);
		//sender_pay_money = (TextView) findViewById(R.id.sender_pay_money);
		// a11_common = (RelativeLayout) findViewById(R.id.a11_common);
		// a12_common = (TextView) findViewById(R.id.a12_common);
		// a0_common = (TextView) findViewById(R.id.a0_common);
		a2_common = (Button) findViewById(R.id.a2_common_new);
		a1_common = (Button) findViewById(R.id.a1_common_new);
		a2_common.setOnClickListener(new ActionButtonClick());
		a1_common.setOnClickListener(new ActionButtonClick());
		// a1_common.setText("接受");
		bargain = (ImageView) findViewById(R.id.bargain);

		title = (TextView) findViewById(R.id.head_title);
		head_left = (ImageView) findViewById(R.id.head_left);
		a9_common = (RelativeLayout) findViewById(R.id.a9_common);
		head_left.setVisibility(View.VISIBLE);
		head_left.setImageResource(R.drawable.back_normal);
		head_left.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				OrderDetails.this.finish();
			}
		});
		title.setText("订单详情");

		a2_common_new_2 = (Button) findViewById(R.id.a2_common_new_2);
		a2_common_new_2.setOnClickListener(new ActionButtonClick());
		a1_common_new_2 = (Button) findViewById(R.id.a1_common_new_2);
		a1_common_new_2.setOnClickListener(new ActionButtonClick());
		driver_imgone = (ImageView) findViewById(R.id.driver_imgone_new);
	}

	private void getPlanDetails() {
		HashMap<String, String> dataMap = new HashMap<String, String>();
		dataMap.put("orderformid", orderListId);
		showLoadingDialog("数据加载中...");
		HttpJsonTool httpJsonTool = new HttpJsonTool(this);
		httpJsonTool.SetOnLister(new Handler() {
			@Override
			public void handleMessage(Message msg) {
				// TODO Auto-generated method stub
				super.handleMessage(msg);
				showLoadingDialog("数据加载中...");
				if (msg.what != 1) {
					dismissLoadingDialog();
					// Toast.makeText(OrderDetails.this, (String) msg.obj,
					OrderDetails.this.finish();
					return;
				}
				orderDataInfo = (List<OrderInfoBeen>) msg.obj;
				Log.v("获得的信息", "获得的信息" + orderDataInfo.size());
				if (orderDataInfo.size() > 0) {
					IniUiInfo();
					dismissLoadingDialog();
				} else {
					dismissLoadingDialog();
					OrderDetails.this.finish();
					Toast.makeText(OrderDetails.this,
							"getPlanDetails-》没有获得订单信息", Toast.LENGTH_LONG)
							.show();
				}

			}
		});
		Type type = new TypeToken<List<OrderInfoBeen>>() {
		}.getType();
		Log.v("GagApi.GET_ORDER_DETIL", "--->" + GagApi.GET_ORDER_DETIL);
		httpJsonTool.StartWork(dataMap, GagApi.GET_ORDER_DETIL, type, null);
	}

	private void IniUiInfo() {
		if (orderDataInfo.size() > 0) {

		} else {
			Log.v("orderDataInfo", "orderDataInfo" + "为空");
			return;
		}
		if (orderDataInfo.get(0).getNeedreceipt() != null) {

			if (orderDataInfo.get(0).getNeedreceipt().equals("2")) {
				View view = findViewById(R.id.driver_up_image);
				view.setVisibility(View.GONE);
			}
		}
		OrderState = orderDataInfo.get(0).getState();
		showalertDialog();
		if ((OrderState==4)&&(play_sound_type!=-1)) {
			app.OrderActivity_data_has_change = true;
		}
		senderPhone.setText(orderDataInfo.get(0).getCargophone());
		senderPhone.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				Intent intent = new Intent();
				// System.out.println("real电话");
				intent.setAction("android.intent.action.CALL");
				// intent.addCategory("android.intent.category.DEFAULT");内部会自动添加类别，
				intent.setData(Uri.parse("tel:"
						+ orderDataInfo.get(0).getCargophone().trim()));
				startActivity(intent);
			}
		});

		if (orderDataInfo.get(0).getFinalprice()>0) {
			View driverinputViewFromDriver=findViewById(R.id.driverinputViewFromDriver);
			driverinputViewFromDriver.setVisibility(View.VISIBLE);
		}else {
			View driverinputViewFromDriver=findViewById(R.id.driverinputViewFromDriver);
			driverinputViewFromDriver.setVisibility(View.GONE);
		}
		
		deiver_input_money.setText(orderDataInfo.get(0).getFinalprice() + "");
		accDriverprivate.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				AcceptOrder();
			}
		});

		TextView cargo_detil = (TextView) findViewById(R.id.cargo_detil);
		cargo_detil.setText(orderDataInfo.get(0).getCargoremark());

		if (OrderState == 1) {
			order_State_TextView.setText("待审核");
		}
		if (OrderState == 2) {
			order_State_TextView.setText("待审核");
		}
		if (OrderState == 3) {
			order_State_TextView.setText("议价中");
			getDriverAddress();
		}
		if (OrderState == 4 || OrderState == 6) {
			order_State_TextView.setText("运送中");
			getDriverAddress();
		}

		if (OrderState == 7) {
			order_State_TextView.setText("已完成");
			getDriverAddress();
		}
		if (OrderState == 8 || OrderState == 5) {
			order_State_TextView.setText("已放弃");
			viewGone();
			View order_bootView = findViewById(R.id.order_bootView);
			order_bootView.setVisibility(View.GONE);

		}

		if (OrderState == 9) {
			getDriverAddress();
			if ((orderDataInfo.get(0).getNeedreceipt() != null)
					&& (orderDataInfo.get(0).getNeedreceipt().equals("1"))) {
				order_State_TextView.setText("回单上传待确认");
			}
			if ((orderDataInfo.get(0).getNeedreceipt() != null)
					&& (orderDataInfo.get(0).getNeedreceipt().equals("2"))) {
				order_State_TextView.setText("货物到达待确认");
			}
			viewGone();
		}
		if (OrderState == 0) {
			getDriverAddress();
			if ((orderDataInfo.get(0).getNeedreceipt() != null)
					&& (orderDataInfo.get(0).getNeedreceipt().equals("1"))) {
				order_State_TextView.setText("回单错误");
			}
			if ((orderDataInfo.get(0).getNeedreceipt() != null)
					&& (orderDataInfo.get(0).getNeedreceipt().equals("2"))) {
				order_State_TextView.setText("未收到货物");
			}
			viewGone();
			a2_common.setVisibility(View.GONE);
			a1_common.setVisibility(View.GONE);
		}

		inPutOrigin.setText(orderDataInfo.get(0).getOrigin());
		NewOrderSate = orderDataInfo.get(0).getState();

		TextView cargo_sender_name = (TextView) findViewById(R.id.cargo_sender_name);
		if (orderDataInfo.get(0).getCargoname() != null) {
			cargo_sender_name.setText(orderDataInfo.get(0).getCargoname());
		}

		Log.v("NewOrderSate", "" + NewOrderSate);
		if (NewOrderSate == 1) {
			myorder_xiangxi_money.setText("￥"
					+ orderDataInfo.get(0).getExpectprice() + "");
			a2_common.setText("放弃订单");
			a1_common.setText("修改订单");
			a1_common.setVisibility(View.GONE);
			a1_common_new_2.setVisibility(View.GONE);
			a2_common_new_2.setVisibility(View.GONE);
			viewGone();
		}
		if (NewOrderSate == 2) {
			myorder_xiangxi_money.setText(orderDataInfo.get(0).getExpectprice()
					+ "");
			a2_common.setText("放弃订单");
			a1_common.setText("修改订单");
			a1_common.setVisibility(View.GONE);
			a1_common_new_2.setVisibility(View.GONE);
			a2_common_new_2.setVisibility(View.GONE);
			viewGone();
		}
		if (NewOrderSate == 3) {
			myorder_xiangxi_money.setText(orderDataInfo.get(0).getExpectprice()
					+ "");
			a2_common.setText("换个司机");
			a1_common.setText("接受要价");
			a1_common_new_2.setText("放弃订单");
			a2_common_new_2.setText("修改订单");
			a2_common_new_2.setVisibility(View.GONE);
		}

		if (NewOrderSate == 4 || NewOrderSate == 6) {
			a2_common.setText("放弃订单");
			myorder_xiangxi_moneytext.setText("最终价格：");
			myorder_xiangxi_money.setText(orderDataInfo.get(0).getFinalprice()
					+ "");
			a1_common.setText("");
			a1_common.setVisibility(View.GONE);
			a1_common_new_2.setVisibility(View.GONE);
			a2_common_new_2.setVisibility(View.GONE);
			viewGone();
		}
		if (NewOrderSate == 7) {
			myorder_xiangxi_moneytext.setText("最终价格：");
			myorder_xiangxi_money.setText(orderDataInfo.get(0).getFinalprice()
					+ "");
			a2_common.setVisibility(View.GONE);
			a1_common.setVisibility(View.GONE);
			a1_common_new_2.setVisibility(View.GONE);
			a2_common_new_2.setVisibility(View.GONE);
			viewGone();
		}

		if (NewOrderSate == 5 || NewOrderSate == 8) {
			myorder_xiangxi_moneytext.setText("货主出价：");
			myorder_xiangxi_money.setText(orderDataInfo.get(0).getFinalprice()
					+ "");
			a2_common.setVisibility(View.GONE);
			a1_common.setVisibility(View.GONE);
			a1_common_new_2.setVisibility(View.GONE);
			a2_common_new_2.setVisibility(View.GONE);
			viewGone();
		}
		if (NewOrderSate == 9 || NewOrderSate == 0) {
			myorder_xiangxi_moneytext.setText("确认回单：");
			myorder_xiangxi_money.setText(orderDataInfo.get(0).getFinalprice()
					+ "");
			viewGone();
			if ((orderDataInfo.get(0).getNeedreceipt() != null)
					&& (orderDataInfo.get(0).getNeedreceipt().equals("1"))) {

				a2_common.setText("回单不正确");
				a1_common.setText("确认回单");
			}
			if ((orderDataInfo.get(0).getNeedreceipt() != null)
					&& (orderDataInfo.get(0).getNeedreceipt().equals("2"))) {
				a2_common.setText("未送达");
				a1_common.setText("已送达");
			}

			a1_common_new_2.setVisibility(View.GONE);
			a2_common_new_2.setVisibility(View.GONE);
		}
		final List<passlocations> plass = orderDataInfo.get(0)
				.getPasslocations();
		int i = 0;
		for (; i < plass.size(); i++) {
			final String str = plass.get(i).getDestination();
			final String phone = plass.get(i).getReceiverphone();
			final String reciverName = plass.get(i).getReceivername();
			if (i == 0) {
				senderAdderss_1.setText(str);
				senderAdderss_1.setOnClickListener(new OnClickListener() {

					@Override
					public void onClick(View arg0) {
						// TODO Auto-generated method stub
						// getPosion(str);
						byte[] byt = new byte[1];
						byt[0] = 1;

					}
				});
				senderPhone_1.setText(phone);

				senderPhone_1.setOnClickListener(new OnClickListener() {

					@Override
					public void onClick(View arg0) {
						// TODO Auto-generated method stub
						Intent intent = new Intent();
						// System.out.println("real电话");
						// 激活源代码,添加intent对象
						intent.setAction("android.intent.action.CALL");
						// intent.addCategory("android.intent.category.DEFAULT");内部会自动添加类别，
						intent.setData(Uri.parse("tel:" + phone));
						// 激活Intent
						startActivity(intent);
					}
				});

				TextView cargoname_1_text = (TextView) findViewById(R.id.cargoname_1_text);
				if (reciverName != null) {
					cargoname_1_text.setText(reciverName);
				}

			}

			if (i == 1) {
				senderAdderss_2.setText(str);
				senderAdderss_2.setOnClickListener(new OnClickListener() {

					@Override
					public void onClick(View arg0) {
						// TODO Auto-generated method stub

					}
				});
				senderPhone_2.setText(phone);
				senderPhone_2.setOnClickListener(new OnClickListener() {

					@Override
					public void onClick(View arg0) {
						// TODO Auto-generated method stub
						Intent intent = new Intent();
						// System.out.println("real电话");
						// 激活源代码,添加intent对象
						intent.setAction("android.intent.action.CALL");
						// intent.addCategory("android.intent.category.DEFAULT");内部会自动添加类别，
						intent.setData(Uri.parse("tel:" + phone));
						// 激活Intent
						startActivity(intent);
					}
				});
				TextView cargoname_2_text = (TextView) findViewById(R.id.cargoname_2_text);
				if (reciverName != null) {
					cargoname_2_text.setText( reciverName);
				}

			}

			if (i == 2) {
				senderAdderss_3.setText(str);
				senderAdderss_3.setOnClickListener(new OnClickListener() {

					@Override
					public void onClick(View arg0) {
						// TODO Auto-generated method stub

					}
				});
				senderPhone_3.setText(phone);
				senderPhone_3.setOnClickListener(new OnClickListener() {

					@Override
					public void onClick(View arg0) {
						// TODO Auto-generated method stub
						Intent intent = new Intent();
						intent.setAction("android.intent.action.CALL");
						intent.setData(Uri.parse("tel:" + phone));
						startActivity(intent);
					}
				});
				TextView cargoname_3_text = (TextView) findViewById(R.id.cargoname_3_text);
				if (reciverName != null) {
					cargoname_3_text.setText( reciverName);
				}
			}
		}
		if (i == 2) {
			View view = findViewById(R.id.cargo_resave_2);
			view.setVisibility(View.GONE);
		}
		if (i == 1) {
			View view1 = findViewById(R.id.cargo_resave_2);
			view1.setVisibility(View.GONE);
			View view2 = findViewById(R.id.cargo_resave_1);
			view2.setVisibility(View.GONE);
		}

		if (orderDataInfo.get(0).getNeedreceipt() == null
				|| orderDataInfo.get(0).getNeedreceipt().length() == 0) {
			View view = findViewById(R.id.driver_up_image);
			view.setVisibility(View.GONE);
		}

		BitmapUtils bitmapUtils = new BitmapUtils(this);
		if (orderDataInfo.get(0).getPhoto1() != null
				&& orderDataInfo.get(0).getPhoto1().length() > 0) {
			ImageView imageView = (ImageView) findViewById(R.id.imageView_photoe1);
			final String path = GagApi.IMAGE_PAHT_HOST
					+ orderDataInfo.get(0).getPhoto1();
			bitmapUtils.display(imageView, path);
			imageView.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					// TODO Auto-generated method stub
					Intent intent = new Intent(OrderDetails.this,
							ImageDetailsActivity.class);
					intent.putExtra("path", path);
					startActivity(intent);
				}
			});
		} else {
			View imageView = findViewById(R.id.imageView_photoe1_view);
			imageView.setVisibility(View.GONE);
		}
		if (orderDataInfo.get(0).getPhoto2() != null
				&& orderDataInfo.get(0).getPhoto2().length() > 0) {
			ImageView imageView = (ImageView) findViewById(R.id.imageView_photoe2);
			final String path = GagApi.IMAGE_PAHT_HOST
					+ orderDataInfo.get(0).getPhoto2();
			bitmapUtils.display(imageView, path);
			imageView.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					// TODO Auto-generated method stub
					Intent intent = new Intent(OrderDetails.this,
							ImageDetailsActivity.class);
					intent.putExtra("path", path);
					startActivity(intent);
				}
			});
		} else {
			View imageView = findViewById(R.id.imageView_photoe2_view);
			imageView.setVisibility(View.GONE);
		}
		if (orderDataInfo.get(0).getPhoto2() != null
				&& orderDataInfo.get(0).getPhoto2().length() > 0) {
			ImageView imageView = (ImageView) findViewById(R.id.imageView_photoe3);
			final String path = GagApi.IMAGE_PAHT_HOST
					+ orderDataInfo.get(0).getPhoto3();
			bitmapUtils.display(imageView, path);
			imageView.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					// TODO Auto-generated method stub
					Intent intent = new Intent(OrderDetails.this,
							ImageDetailsActivity.class);
					intent.putExtra("path", path);
					startActivity(intent);
				}
			});
		} else {
			View imageView = findViewById(R.id.imageView_photoe3_view);
			imageView.setVisibility(View.GONE);
		}

		ImageView driver_up = (ImageView) findViewById(R.id.driver_imgone_new);
		// BitmapUtils bitmapUtils = new BitmapUtils(this);
		if ((orderDataInfo.get(0).getEvidencepictureurl() != null)) {
			if ((!orderDataInfo.get(0).getEvidencepictureurl().equals("null"))) {
				bitmapUtils.display(driver_up, GagApi.IMAGE_PAHT_HOST
						+ orderDataInfo.get(0).getEvidencepictureurl());
				driver_up.setOnClickListener(new OnClickListener() {

					@Override
					public void onClick(View arg0) {
						// TODO Auto-generated method stub
						Intent intents = new Intent(OrderDetails.this,
								ImageDetailsActivity.class);
						intents.putExtra("path", GagApi.IMAGE_PAHT_HOST
								+ orderDataInfo.get(0).getEvidencepictureurl());
						startActivity(intents);
					}
				});
			}
		}
		
		needvoucher.setText("");
		String needStr="";
		if (orderDataInfo.get(0).getPayment() == 0) {
			needStr="发货人线下付款";
		}

		if (orderDataInfo.get(0).getPayment() == 1) {
			needStr="收货人线下付款";
		}
		
		needStr=needStr+"、"+orderDataInfo.get(0).getCartypename();
		if (orderDataInfo.get(0).getNeedtransport() == 1) {
			needStr=needStr+"、"+"需要搬运工";
		}
		if (needStr.length()<=0) {
			View sep_view=findViewById(R.id.sep_view);
			sep_view.setVisibility(View.GONE);
		}
		needvoucher.setText(needStr);
		bargain.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				Intent intent = new Intent(OrderDetails.this,
						BargainActionActivity.class);
				ReceiveOrderMessageBeen receiveOrderMessageBeen = new ReceiveOrderMessageBeen();
				receiveOrderMessageBeen.setOrderId(orderListId);
				if (orderDataInfo != null) {
					receiveOrderMessageBeen.setReceiver(""
							+ orderDataInfo.get(0).getCargoid());
				} else {
					Toast.makeText(OrderDetails.this, "没有获得货物信息",
							Toast.LENGTH_LONG).show();
					return;
				}
				receiveOrderMessageBeen.setSender(orderDataInfo.get(0)
						.getCargoownerid());
				receiveOrderMessageBeen.setReceiver(orderDataInfo.get(0)
						.getCarownerid());

				receiveOrderMessageBeen.setSendertype("1");
				receiveOrderMessageBeen.setReceivertype("2");
				intent.putExtra("MessageData", receiveOrderMessageBeen);
				startActivity(intent);
			}
		});

	}

	private void getDriverAddress() {
		// TODO Auto-generated method stub
		HashMap<String, Object> data = new HashMap<String, Object>();
		data.put("carownerid", orderDataInfo.get(0).getCarownerid());
		Log.e("getDriverAddress", "getDriverAddress");
		Type type = new TypeToken<List<DriverAddress>>() {
		}.getType();
		HttpJsonTool httpJsonTool = new HttpJsonTool(this);
		httpJsonTool.SetOnLister(new Handler() {
			@Override
			public void handleMessage(Message msg) {
				// TODO Auto-generated method stub
				super.handleMessage(msg);
				if (msg.what == 1) {
					driverAddress = (List<DriverAddress>) msg.obj;
					if (!driverAddress.isEmpty()) {
						setDriverinfoToUI();
					}
				}
			}
		});
		httpJsonTool.StartWork(data, GagApi.GET_DRIVER_ADDRESS, type, null);
	}

	private void setDriverinfoToUI() {
	//	DriverAddress data=driverAddress.get(0);
		View view = findViewById(R.id.driver_info);
		view.setVisibility(View.VISIBLE);
		TextView driver_name = (TextView) findViewById(R.id.driver_name);
		if (driverAddress.get(0).getCarownername() != null) {
			driver_name.setText("司机名字：" + driverAddress.get(0).getCarownername());
		}
		TextView driver_phone = (TextView) findViewById(R.id.driver_phone);
		driver_phone.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG);
		driver_phone.getPaint().setAntiAlias(true);
		if (driverAddress.get(0).getPhone() != null) {
			driver_phone.setText(driverAddress.get(0).getPhone());
			driver_phone.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View arg0) {
					// TODO Auto-generated method stub
					Intent intent = new Intent();
					// System.out.println("real电话");
					// 激活源代码,添加intent对象
					intent.setAction("android.intent.action.CALL");
					// intent.addCategory("android.intent.category.DEFAULT");内部会自动添加类别，
					intent.setData(Uri.parse("tel:" + driverAddress.get(0).getPhone()));
					// 激活Intent
					startActivity(intent);
				}
			});
		}
		TextView driver_address = (TextView) findViewById(R.id.driver_address);
		// driver_address.getPaint().setFlags(Paint. UNDERLINE_TEXT_FLAG );
		// driver_address.getPaint().setAntiAlias(true);\
		if ((!(OrderState == 7))&&(!(OrderState == 8))) {
			if (driverAddress.get(0).getLocation() != null) {
				driver_address.setText("司机当前地址：" + driverAddress.get(0).getLocation());
			}
		} else {
			driver_address.setVisibility(View.GONE);
		}
	
		TextView driver_license = (TextView) findViewById(R.id.driver_license);
		if (driverAddress.get(0).getLicenseplate() != null) {
			String dataString = driverAddress.get(0).getLicenseplate();
			int strLean = dataString.length();
			if (strLean > 3) {
//				dataString = dataString.substring(0, strLean - 3) + "**"+ dataString.substring(strLean - 1,strLean);
				driver_license.setText("司机车牌号：" + dataString);
			} else {
				driver_license.setText("司机车牌号：" + driverAddress.get(0).getLicenseplate());
			}

		}
	//	final String driverPhone=data.getPhone();
	//	final String driverName =data.getCarownername();
		 add_driver_to_linkman=(TextView) findViewById(R.id.add_driver_to_linkman);
		add_driver_to_linkman.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				addDriver(driverAddress.get(0).getPhone(), driverAddress.get(0).getCarownername());
			}
		});
		
		TextView driver_in_map=(TextView) findViewById(R.id.driver_in_map);
		if ((!(OrderState == 7))&&(!(OrderState == 8))) {
			driver_in_map.setVisibility(View.VISIBLE);
		}else {
			driver_in_map.setVisibility(View.GONE);
		}
	
		driver_in_map.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				Intent intent=new Intent(OrderDetails.this,ShowDriverInMap.class);
				if (driverAddress.get(0).getLatitude()!=null&&driverAddress.get(0).getLongitude()!=null&&driverAddress.get(0).getLatitude().length()>0&&driverAddress.get(0).getLongitude().length()>0) {
					intent.putExtra("driverInfo", driverAddress.get(0));
					startActivity(intent);
				}else {
					Toast.makeText(OrderDetails.this, "司机未在线", Toast.LENGTH_LONG).show();
					getDriverAddress();
				}
			
			}
		});
		
	}

	private void addDriver(String driverPhone, String driverName) {
		// TODO Auto-generated method stub
		HashMap<String, Object> data = new HashMap<String, Object>();
		data.put("phone", driverPhone);
		data.put("carownername", driverName);
		data.put("tcargoownerid", app.userId);
		HttpJsonTool httpJsonTool = new HttpJsonTool(this);
		httpJsonTool.SetOnLister(new Handler() {
			@Override
			public void handleMessage(Message msg) {
				// TODO Auto-generated method stub
				super.handleMessage(msg);
				if (msg.what == 1) {
					//getLinkManInfo();
					add_driver_to_linkman.setVisibility(View.GONE);
					Toast.makeText(OrderDetails.this, "添加成功", Toast.LENGTH_LONG).show();
				}else {
					Toast.makeText(OrderDetails.this, (String)msg.obj, Toast.LENGTH_LONG).show();
				}
			}
		});
		httpJsonTool.StartWork(data, GagApi.ADD_LINK_MAN, null, null);
	}

	
	
	private void viewGone() {
//		View driverinputView = findViewById(R.id.driverinputView);
//		driverinputView.setVisibility(View.GONE);
		View barg_layout = findViewById(R.id.barg_layout);
		barg_layout.setVisibility(View.GONE);
		View driverinputViewFromDriver = findViewById(R.id.driverinputViewFromDriver);
		driverinputViewFromDriver.setVisibility(View.GONE);
	}


	public class ActionButtonClick implements OnClickListener {

		@Override
		public void onClick(View view) {
			// TODO Auto-generated method stub

			switch (view.getId()) {
			// a2_common是左边

			case R.id.a2_common_new:
				if (NewOrderSate == 1) {
					// Log.v("左边点击了", "左边点击了");
					rejectOrder();
				}
				if (NewOrderSate == 2) {
					InPutDialog inPutDialog=new InPutDialog(OrderDetails.this, "提示", "您是否要放弃订单？", "确定", "取消");
					inPutDialog.setGetUserIntent(new getUserIntent() {

						@Override
						public void getUserIntentInfo() {
							// TODO Auto-generated method stub
							rejectOrder();
						}
					});
					inPutDialog.getCheckDialog(false);
					
				}
				if (NewOrderSate == 3) {
					resetOrderStaeAPP();
				}
				if (NewOrderSate == 4 || NewOrderSate == 6) {
					InPutDialog inPutDialog=new InPutDialog(OrderDetails.this, "提示", "是否放弃订单", "放弃", "取消");
					inPutDialog.setGetUserIntent(new getUserIntent() {

						@Override
						public void getUserIntentInfo() {
							// TODO Auto-generated method stub
							GiveUpOrder();
						}
					});
					inPutDialog.getCheckDialog(false);
				}

				if (NewOrderSate == 9 || NewOrderSate == 0) {
					userRejectReceipt();
				}

				break;

			case R.id.a1_common_new:
				if (NewOrderSate == 1) {
					ModificationOrder();
				}
				if (NewOrderSate == 2) {

					ModificationOrder();
				}
				if (NewOrderSate == 3) {

					AcceptOrder();
				}
				if (NewOrderSate == 4) {

				}
				if (NewOrderSate == 6) {

				}
				if (NewOrderSate == 9 || NewOrderSate == 0) {

					CompleteOrder();
				}
				break;
			case R.id.a1_common_new_2:
				rejectOrder();
				break;
			case R.id.a2_common_new_2:
				// ModificationOrder();
				// AcceptOrder();
				break;

			default:
				break;
			}
		}

	}

	private void showalertDialog() {
		String title = "", pMessage = "";
		// Log.v("", play_sound_type+"");
		switch (OrderState) {
		case 1:

			break;
		case 2:
			title = "订单被司机拒接";
			pMessage = " 将分配新的司机";
			break;
		case 3:
			title = "订单";
			pMessage = "请查看新订单，可点击议价按钮同司机议价";
			break;
		case 4:
			title = "恭喜您！";
			pMessage = "您的订单司机已承接";
			break;
		case 9:
			title = "请确认";
			pMessage = "司机已完成订单";
			break;
		case 0:
			title = "已通知司机";
			pMessage = "再次确认";
			break;
		default:
			break;
		}
		if (play_sound_type == 3 && OrderState == 3) {
			title = "订单分配成功";
			pMessage = " 您的订单已分配给司机";
		}
		if (play_sound_type == 2 && OrderState == 3) {
			title = "司机的新信息";
			pMessage = "司机给你发送了一个新的消息，请点击议价按钮查看";
		}
		Log.v("新的更新", "新的更新");
		if (orderDataInfo.get(0).getFinalprice() != 0.0) {
			if (play_sound_type == 3 && OrderState == 3) {
				title = "司机报价";
				pMessage =  orderDataInfo.get(0).getFinalprice()
						+ "元";
			}
		}
		if (play_sound_type == 5 && OrderState == 3) {
			title = "标价被司机拒绝";
			pMessage = "被司机拒绝，将分配新的司机";
		}
		if (play_sound_type==3&&OrderState==4) {
			title = " 司机已接单";
			pMessage = "正在提货中";
		}
		Log.v("showpass", "--->"+showpass);
		Log.v("play_sound_type","--->"+play_sound_type );
		if (!showpass) {
			if ((play_sound_type != -1)) {
				if ((!title.equals("")) && (!pMessage.equals(""))) {
					Log.v(title, pMessage);
					InPutDialog inPutDialog = new InPutDialog(this, title,
							pMessage, null, null);
					inPutDialog.getCheckDialog(true);
				}
			}
		}
	}

	public String getTakePicturePath() {
		return mTakePicturePath;
	}

	@Override
	protected void onNewIntent(Intent intent) {
		// TODO Auto-generated method stub
		super.onNewIntent(intent);
		setContentView(R.layout.activity_myorder_conent_xiang_user);
		showpass=false;
		getIntentBundle(intent);
	}

//	@Override
//	protected void onResume() {
//		// TODO Auto-generated method stub
//		super.onResume();
//	}
	
	
	@Override
	protected void onRestart() {
		// TODO Auto-generated method stub
		super.onRestart();
		if (app.New_Order_Push) {
			showpass = true;
			getPlanDetails();
		}
	}

	@Override
	protected void onDestroy() {
		// TODO Auto-generated method stub
		super.onDestroy();

	}

	@Override
	public void onClick(View arg0) {
		// TODO Auto-generated method stub

	}

}
